﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;
using Entities;

namespace Mapping
{
    public class DirectionMap : ClassMap<Direction>
    {
        public DirectionMap()
        {
            Id(x => x.Id)
                .GeneratedBy.Identity();
            Map(x => x.DirectionTitle)
                .Not.Nullable();
            Map(x => x.Code);
            HasMany(x => x.StudyPlanItems)
                .Cascade.Delete()
                .KeyColumn("DirectionId")
                .Inverse();
            HasMany(x => x.Groups)
                .Cascade.Delete()
                .KeyColumn("DirectionId")
                .Inverse();
        }
    }
}
